<?php
if( !defined( '_VALID_MOS' ) && !defined( '_JEXEC' ) ) die( 'Direct Access to '.basename(__FILE__).' is not allowed.' );
/**
* @version		$Id: niftydefault.php
* @package		VirtueMart
* @subpackage modules
* @copyright	Copyright (C) 2012 Peter Osipof, 2009 Grigory Fedorinov, 2007 - 2008 Greg Perkins, 2007 -2008 YOOtheme Ltd. & Co. KG. All rights reserved.
* @license		GNU/GPL, http://www.gnu.org/copyleft/gpl.html
*
* VirtueMart is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
* See /administrator/components/com_virtuemart/COPYRIGHT.php for copyright notices and details.
*
* http://virtuemart.net
*/
?>

<?php if($type == 'logout') : ?>
<form action="index.php" method="post" name="login">
<?php else : ?>
<?php if(JPluginHelper::isEnabled('authentication', 'openid')) :
$lang->load( 'plg_authentication_openid', JPATH_ADMINISTRATOR );
$langScript = 	'var JLanguage = {};'.
                        ' JLanguage.WHAT_IS_OPENID = \''.JText::_( 'WHAT_IS_OPENID' ).'\';'.
                        ' JLanguage.LOGIN_WITH_OPENID = \''.JText::_( 'LOGIN_WITH_OPENID' ).'\';'.
                        ' JLanguage.NORMAL_LOGIN = \''.JText::_( 'NORMAL_LOGIN' ).'\';'.
                        ' var modlogin = 1;';
$document = &JFactory::getDocument();
$document->addScriptDeclaration( $langScript );
JHTML::_('script', 'openid.js');
endif; ?>
<form action="<?php echo JRoute::_( 'index.php', true, $params->get('usesecure')); ?>" method="post" name="login">
    <?php endif; ?>

    <span class="<?php echo $style ?>" style="display: block;">
        <span class="yoo-login">
            <?php if($type == 'logout') : ?>
            <span class="logout">

                <?php if ($params->get('greeting')) : ?>
                <span class="greeting">
                <?php if ($params->get('name')) : {
                		echo JText::sprintf( 'HINAME', $user->get('name') );
                } else : {
                		echo JText::sprintf( 'HINAME', $user->get('username') );
                } endif; ?>
                </span>
                <?php endif; ?>

                <span class="logout-button<?php echo "-" . $logout_button ?>">
                    <button value="<?php echo JText::_( 'BUTTON_LOGOUT'); ?>" name="Submit" type="submit" title="<?php echo JText::_('BUTTON_LOGOUT'); ?>"><?php echo JText::_( 'BUTTON_LOGOUT'); ?></button>
                </span>

                <input type="hidden" name="option" value="com_user" />
                <input type="hidden" name="task" value="logout" />
                <input type="hidden" name="return" value="<?php echo $return; ?>" />

            </span>
            <?php if( $params->get('accountlink') || ENABLE_DOWNLOADS == '1' ) : ?>
            <ul>
                <?php if( $params->get('accountlink')) : ?>
                <li><a href="<?php echo $sess->url(SECUREURL . "index.php?page=account.index");?>"><?php echo $VM_LANG->_('PHPSHOP_ACCOUNT_TITLE') ?></a></li>
                <?php endif; ?>
                <?php if( $params->get('download') && ENABLE_DOWNLOADS == '1' ) : ?>
                <li><a href="<?php $sess->purl(SECUREURL . "index.php?page=shop.downloads");?>"><?php echo $VM_LANG->_('PHPSHOP_DOWNLOADS_TITLE') ?></a></li>
                <?php endif; ?>
                <?php
                // Show the Frontend ADMINISTRATION Link
                $perm = new ps_perm;
                if ($perm->check("admin,storeadmin")
                    && ((!stristr($my->get('usertype'), "admin") ^ PSHOP_ALLOW_FRONTENDADMIN_FOR_NOBACKENDERS == '' )
                        || stristr($my->get('usertype'), "admin")
                    )
                    && $show_adminlink == 'yes'
                ) { ?>
                <li>
                    <a class="<?php echo $class_mainlevel ?>" href="<?php $sess->purl(SECUREURL . "index2.php?page=store.index&pshop_mode=admin") ?>">
                        <?php echo $VM_LANG->_('PHPSHOP_ADMIN_MOD'); ?>
                    </a>
                </li>

                <?php
                }
                ?>
            </ul>
            <?php endif; ?>

            <?php else : ?>
            <span class="login">

                <?php echo $params->get('pretext'); ?>

                <span class="username">

                    <?php if ($text_mode == "input") { ?>
                    <input type="text" name="username" size="18" value="<?php echo JText::_( 'Username' ); ?>" onblur="if(this.value=='') this.value='<?php echo JText::_( 'Username' ); ?>';" onfocus="if(this.value=='<?php echo JText::_( 'Username' ); ?>') this.value='';" />
                    <?php } else { ?>
                    <label for="modlgn_username<?php echo $vmlogin_id; ?>"><?php echo JText::_( 'Username' ); ?></label>
                    <br />
                    <input id="modlgn_username<?php echo $vmlogin_id; ?>" type="text" name="username" size="18" />
                    <?php } ?>

                </span>

                <span class="password">

                    <?php if ($text_mode == "input") { ?>
                    <input type="password" name="passwd" size="10" value="<?php echo JText::_( 'Password' ); ?>" onblur="if(this.value=='') this.value='<?php echo JText::_( 'Password' ); ?>';" onfocus="if(this.value=='<?php echo JText::_( 'Password' ); ?>') this.value='';" />
                    <?php } else { ?>
                    <label for="modlgn_passwd<?php echo $vmlogin_id; ?>"><?php echo JText::_( 'Password' ); ?></label>
                    <br />
                    <input id="modlgn_passwd<?php echo $vmlogin_id; ?>" type="password" name="passwd" size="10" />
                    <?php } ?>

                </span>

                <?php if(JPluginHelper::isEnabled('system', 'remember')) : ?>
                <?php if ( $auto_remember ) { ?>
                <input type="hidden" name="remember" value="yes" />
                <?php } else { ?>
                <span class="remember">
                    <input id="modlgn_remember<?php echo $vmlogin_id; ?>" type="checkbox" name="remember" value="yes" />
                    <label for="modlgn_remember<?php echo $vmlogin_id; ?>"><?php echo JText::_( 'Remember me' ); ?></label>
                </span>
                <?php } ?>
            <?php endif; ?>

                <span class="login-button-container">
                    <span class="login-button<?php echo "-" . $login_button ?>">
                        <button value="<?php echo JText::_( 'BUTTON_LOGIN'); ?>" name="Submit" type="submit" title="<?php echo JText::_('BUTTON_LOGIN'); ?>"><?php echo JText::_( 'BUTTON_LOGIN'); ?></button>
                    </span>
                </span>

                <?php if ( $lost_password ) { ?>
                <span class="lostpassword">
                    <a href="<?php echo JRoute::_( 'index.php?option=com_user&view=reset' ); ?>"><?php echo JText::_('FORGOT_YOUR_PASSWORD'); ?></a>
                </span>
                <?php } ?>

            <?php if ( $lost_username ) { ?>
                <span class="lostusername">
                    <a href="<?php echo JRoute::_( 'index.php?option=com_user&view=remind' ); ?>"><?php echo JText::_('FORGOT_YOUR_USERNAME'); ?></a>
                </span>
                <?php } ?>

            <?php
            $usersConfig = &JComponentHelper::getParams( 'com_users' );
            if ($usersConfig->get('allowUserRegistration') && $registration) { ?>
                <span class="registration">
                    <a href="<?php echo $registration_url ?>"><?php echo JText::_( 'REGISTER'); ?></a>
                </span>
                <?php } ?>

            <?php echo $params->get('posttext'); ?>

                <input type="hidden" name="option" value="com_user" />
                <input type="hidden" name="task" value="login" />
                <input type="hidden" name="return" value="<?php echo $return; ?>" />
                <?php echo JHTML::_( 'form.token' ); ?>

            </span>

            <?php endif; ?>

        </span>
    </span>
</form>